using System;
using System.Linq;
using MvcMall.Framework.Utility;
using NUnit.Framework;

namespace MvcMall.Tests.MvcMallFramework
{
    [TestFixture]
    public class CryptToolsTest
    {
        [Test]
        public void CryptTest()
        {
            string password = "admin";
            Console.WriteLine(CryptTools.HashPassword(password));
        }

        [Test]
        public void GuidTest()
        {
            var str = DateTime.Now.ToString("yyyyMMddHHmmssffff");
            str = CryptTools.Encrypt(str, "mvcmall");
            Console.WriteLine(str);

            str = CryptTools.Decrypt(str, "mvcmall");
            Console.WriteLine(str);
        }

        [Test]
        public void LinqTest()
        {
            Int32[] arr1 = { 1, 2, 3, 4, 5, 6 };
            Int32[] arr2 = { 1, 2, 4 };
            var result = (from a in arr1.ToList()
                          join b in arr2.ToList() on a equals b
                          select a
                         ).ToList();
            foreach (var i in result)
            {
                Console.WriteLine(i);
            }
        }

    }
}